package com.xhd.file;

import java.io.File;
import java.io.FileInputStream;

public class XCompressedFile2 {
	private int jm42 = 0;
	private int[] jm43 = new int[256];

	public int getCRC32(File paramFile) throws Exception {
		FileInputStream localFileInputStream = null;
		if (paramFile == null)
			throw new Exception("File not found.");
		try {
			localFileInputStream = new FileInputStream(paramFile);
		} catch (Exception localException1) {
			throw new Exception("File not found.");
		}
		try {
			jm40();
			int i = 0;
			int j = -1;
			byte[] arrayOfByte = new byte[10239];
			int k = localFileInputStream.available() - this.jm42;
			while (k > 0) {
				if (k >= 10240)
					i = 10240;
				else
					i = k;
				arrayOfByte = new byte[i];
				int l = localFileInputStream.read(arrayOfByte);
				for (int i1 = 0; i1 < l; ++i1)
					j = jm41(j, 8) & 0xFFFFFF
							^ this.jm43[((j ^ arrayOfByte[i1]) & 0xFF)];
				k -= i;
			}
			localFileInputStream.close();
			int l = j ^ 0xFFFFFFFF;
			return l;
		} catch (Exception localException2) {
			try {
				if (localFileInputStream != null)
					localFileInputStream.close();
			} catch (Exception localException3) {
			}
			throw new Exception("File read error: "
					+ localException2.getMessage());
		}
	}

	private void jm40() {
		int j = -306674912;
		for (int k = 0; k <= 255; ++k) {
			int i = k;
			for (int l = 8; l >= 1; --l)
				if ((i & 0x1) == 1)
					i = jm41(i, 1) ^ j;
				else
					i = jm41(i, 1);
			this.jm43[k] = i;
		}
	}

	private int jm41(int paramInt1, int paramInt2) {
		int i = paramInt1 >> paramInt2;
		if (paramInt1 < 0) {
			int j = 2147483647;
			i &= j;
		}
		return i;
	}
}
